#ifndef KMSINSTALLACTIVATIONTHREAD_H
#define KMSINSTALLACTIVATIONTHREAD_H
#include <QObject>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <QtNetwork>
#include <QTimer>
#include <QMessageBox>
//#include "receive_dbus.h"
#include "definition.h"
#include <QSettings>
#include <QDir>
#include <QFileInfo>
#include <QFile>
#include <QNetworkRequest>
#include <unistd.h>
#include <string.h>
#include <QProcess>
#include "hardware_info.h"
#include "socketmanager.h"
extern "C" {
#include <kylin-activation.h>
}

extern "C" {
extern int encrypt_hardware_info(const char* hw_info, unsigned int in_size, unsigned char* out, unsigned int *out_size);
}

#define UEVENT_BUFFER_SIZE 2048

class KmsInstallActivationThread : public QObject
{
    Q_OBJECT
public:
    explicit KmsInstallActivationThread(QObject *parent=0);
    void init_udpinfo();
    QNetworkAccessManager *m_accessManager_Registered = new QNetworkAccessManager();

    QTimer *timer;

public slots:
    void sendudp();
    void receiveudp();
    void receivetcp();
    void sendtcp();
    void sendInfo();

private:
    int port, broadcast_num;
    bool isStarted;
    QString udp_send_info, tcp_send_info, register_number, serial_number, server_dns;
    QUdpSocket *udpSocket;
    QHostAddress serverip;
    QTcpSocket *tcpSocket;
    int protocolType=1;
};

#endif // KMSINSTALLACTIVATIONTHREAD_H
